Skip to content

Conversation

VincentLanglet
Copy link
Contributor

@VincentLanglet VincentLanglet commented Jul 28, 2025

@VincentLanglet VincentLanglet changed the title Try to fix 13296 Fix 13296 Jul 28, 2025
} elseif (
$node->name instanceof FuncCall
&& $node->name->name instanceof Name
&& $node->name->isFirstClassCallable()
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like the purpose of this if was to resolve node like
strtoupper(...)($foo)
which is resolved to strtoupper($foo)
but it messed up with foo($bar)($baz)
which was resolved to foo($baz).

*/
public function test($a, $b)
{
assertType('string', current($a)($b));
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without the fix, the type is understood as current($b) which is int.

@VincentLanglet VincentLanglet marked this pull request as ready for review July 28, 2025 18:06
@phpstan-bot
Copy link
Collaborator

This pull request has been marked as ready for review.

@AJenbo
Copy link
Contributor

AJenbo commented Jul 28, 2025

Thanks

@ondrejmirtes
Copy link
Member

Please use more descriptive PR titles than "Fix 13296" next time.

@ondrejmirtes ondrejmirtes merged commit 6b33ea1 into phpstan:2.1.x Jul 28, 2025
414 of 420 checks passed
@ondrejmirtes
Copy link
Member

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2.1.18 __invoke return type not recognized depending on how the class is resolved

4 participants